#include <stdatomic.h>
#include <stdint.h>
#include <mthread.h>
#include <assert.h>
#include <sys/syscall.h>

int mthread_spin_init(mthread_spinlock_t *lock)
{
    // TODO:
}
int mthread_spin_destroy(mthread_spinlock_t *lock) {
    // TODO:
}
int mthread_spin_trylock(mthread_spinlock_t *lock)
{
    // TODO:
}
int mthread_spin_lock(mthread_spinlock_t *lock)
{
    // TODO:
}
int mthread_spin_unlock(mthread_spinlock_t *lock)
{
    // TODO:
}

int mthread_mutex_init(mthread_mutex_t *lock)
{
    // TODO:
}
int mthread_mutex_destroy(mthread_mutex_t *lock) {
    // TODO:
}
int mthread_mutex_trylock(mthread_mutex_t *lock) {
    // TODO:
}
int mthread_mutex_lock(mthread_mutex_t *lock) {
    // TODO:
}
int mthread_mutex_unlock(mthread_mutex_t *lock)
{
    // TODO:
}

int mthread_barrier_init(mthread_barrier_t key, unsigned count)
{
    return invoke_syscall(SYSCALL_BARRIER_INIT, key, count, IGNORE,IGNORE);
}
int mthread_barrier_wait(mthread_barrier_t key)
{
    return invoke_syscall(SYSCALL_BARRIER_WAIT, key, IGNORE, IGNORE,IGNORE);
}
int mthread_barrier_destroy(mthread_barrier_t key)
{
    return invoke_syscall(SYSCALL_BARRIER_DESTROY, key, IGNORE, IGNORE,IGNORE);
}

int mthread_cond_init(int key)
{
    return invoke_syscall(SYSCALL_CONDITION_INIT,key,IGNORE,IGNORE,IGNORE);
}
int mthread_cond_destroy(int key) 
{
    return invoke_syscall(SYSCALL_CONDITION_DESTROY,key,IGNORE,IGNORE,IGNORE);
}
int mthread_cond_wait(int key,int lock_id)
{
    return invoke_syscall(SYSCALL_CONDITION_WAIT,key,lock_id,IGNORE,IGNORE);
    
}
int mthread_cond_signal(int key)
{
    return invoke_syscall(SYSCALL_CONDITION_SIGNAL,key,IGNORE,IGNORE,IGNORE);
    // TODO:
}
int mthread_cond_broadcast(int key)
{
    return invoke_syscall(SYSCALL_CONDITION_BROADCAST,key,IGNORE,IGNORE,IGNORE);
    // TODO:
}

int mthread_semaphore_init(mthread_semaphore_t *sem, int val)
{
    // TODO:
}
int mthread_semaphore_up(mthread_semaphore_t *sem)
{
    // TODO:
}
int mthread_semaphore_down(mthread_semaphore_t *sem)
{
    // TODO:
}
int mthread_semaphore_destroy(mthread_semaphore_t *sem)
{
    // TODO:
}